<template>
    <div>
        <Table ref="dataTable" stripe :loading="table.loading" :columns="table.tableColumns" :data="table.tableRows"
               style="margin-top:20px;" @on-select="select" @on-select-cancel="selectCancel"
               @on-select-all="selectAll" @on-select-all-cancel="selectAllCancel" @on-sort-change="changeSort"></Table>
        <div style="margin: 20px; overflow: hidden">
            <div style="float: right;">
                <Page :total="pager.total" :current="pager.pageNo" @on-change="changePageNo" @on-page-size-change="changePageSize"
                      showSizer showTotal></Page>
            </div>
        </div>
    </div>
</template>

<script>
    import * as utils from '@/api/utils-v2'

    export default {
        name: 'SchoolOrderAddressUserTable',
        data() {
            return {
                urls: {
                    searchUrl: '/school-order-address-user/admin/pager-cond'
                },
                pager: {
                    pageNo: 1,
                    pageSize: 10,
                    total: 0
                },
                searchOpts: {
                    sortColumn: null,
                    sortOrder: null,
                },
                table: {
                    loading: false,
                    tableColumns: [{
                        type: 'selection',
                        width: 52,
                        key: 'id',
                        align: 'center',
                        fixed: 'left'
                    },
                        {
                            width: 60,
                            align: 'center',
                            fixed: 'left',
                            render: (h, params) => {
                                return h('span', params.index + (this.pager.pageNo - 1) * this.pager.pageSize + 1)
                            }
                        },
                        {
title: '主键',
key: 'schoolOrderId',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderId) 
}
},
{
title: '下单用户ID',
key: 'schoolOrderUserId',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderUserId) 
}
},
{
title: '接单人id',
key: 'schoolOrderOrderUserId',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderOrderUserId) 
}
},
{
title: '学校ID',
key: 'schoolOrderSchoolId',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderSchoolId) 
}
},
{
title: '备注',
key: 'schoolOrderNotes',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderNotes) 
}
},
{
title: '包裹大小',
key: 'schoolOrderParcel',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderParcel) 
}
},
{
title: '订单金额',
key: 'schoolOrderTotalAmount',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderTotalAmount) 
}
},
{
title: '实付金额',
key: 'schoolOrderPayAmount',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderPayAmount) 
}
},
{
title: '优惠金额',
key: 'schoolOrderDiscountAmount',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderDiscountAmount) 
}
},
{
title: '送达时间',
key: 'schoolOrderDelivery',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderDelivery) 
}
},
{
title: '优惠券ID',
key: 'schoolOrderCouponsId',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderCouponsId) 
}
},
{
title: '更新时间',
key: 'schoolOrderUpdateTime',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderUpdateTime) 
}
},
{
title: '创建时间',
key: 'schoolOrderCreateTime',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderCreateTime) 
}
},
{
title: '订单状态',
key: 'schoolOrderStatus',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderStatus) 
}
},
{
title: '支付状态',
key: 'schoolOrderPayStatus',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderPayStatus) 
}
},
{
title: '激活状态',
key: 'schoolOrderIsActive',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderIsActive) 
}
},
{
title: '下单时间',
key: 'schoolOrderPlaceOrderTime',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderPlaceOrderTime) 
}
},
{
title: '取件点',
key: 'schoolOrderPlace',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderPlace) 
}
},
{
title: '骑手佣金',
key: 'schoolOrderCommission',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderCommission) 
}
},
{
title: '收件人',
key: 'schoolOrderAddressRealName',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderAddressRealName) 
}
},
{
title: '手机号',
key: 'schoolOrderAddressPhone',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderAddressPhone) 
}
},
{
title: '详细地址',
key: 'schoolOrderAddressAddress',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderAddressAddress) 
}
},
{
title: '区域、宿舍号',
key: 'schoolOrderAddressArea',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderAddressArea) 
}
},
{
title: '楼栋',
key: 'schoolOrderAddressStoriedBuilding',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderAddressStoriedBuilding) 
}
},
{
title: '学校',
key: 'schoolOrderAddressSchool',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.schoolOrderAddressSchool) 
}
},
{
title: '用户编号',
key: 'userId',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.userId) 
}
},
{
title: '手机号',
key: 'userPhone',
minWidth: 120,
sortable: true,
render: (h, params) => {
 return h('span',{}, params.row.userPhone) 
}
},

                        {
                            title: '操作',
                            key: 'action',
                            width: 80,
                            align: 'center',
                            fixed: 'right',
                            render: (h, params) => {
                                return h('div', [
                                    h('Button', {
                                        props: {
                                            type: 'primary',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.showDetail(params.row)
                                            }
                                        }
                                    }, '详情')
                                ])
                            }
                        }
                    ],
                    tableRows: [],
                    selections: []
                }
            }
        },
        computed: {},
        mounted() {
            this.search()
        },
        methods: {
            search() {
                this.$emit('searchTable')
            },
            showDetail(row) {
                this.$emit('showDetailModal', JSON.parse(JSON.stringify(row)))
            },
            select(selections, row) {
              utils.select(this, selections, row)
            },
            selectCancel(selections, row) {
              utils.selectCancel(this, selections, row)
            },
            selectAll(selections) {
              utils.selectAll(this, selections)
            },
            selectAllCancel(selections) {
              utils.selectAllCancel(this, selections)
            },
            changeSort(sortColumn) {
                utils.changeSort(this, sortColumn)
            },
            changePageNo(pageNo) {
                utils.changePageNo(this, pageNo)
            },
            changePageSize(pageSize) {
                utils.changePageSize(this, pageSize)
            }
        }
    }
</script>

<style>
</style>